﻿using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using hieunv.MVC3.App.Models;
namespace hieunv.MVC3.App.Controllers
{
    public class CustomerController : Controller
    {
        public ActionResult Index()
        {
			List<Customer> customers = DataContext.Context.Customers.ToList<Customer>();
			return View(customers);
			
        }
		public ViewResult Insert()
		{
			return View();
		}
		[AcceptVerbs(HttpVerbs.Post)]
		public ActionResult Insert(string customerID, string companyName)
		{	
            (new Customer(customerID, companyName)).Insert();
			return RedirectToAction("Index");
		}
		public ActionResult Delete(string id)
		{
            Customer.Get(id).Delete();
			return RedirectToAction("Index");
		}
    }
}